Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Let's break through the world's most popular WordPress captcha plugin. Everyone hates captchas - you are always asked to enter the text contained in those annoying images before you are allowed to visit a website. The verification code is designed to verify that you are a real person to prevent the computer from automatically filling out the form. But with the rise of deep learning and computer vision, they are now often easily broken. I am reading Adrian Rosebrock's excellent book, Python Computer Vision Deep Learning. In the book, Adrian simply describes how he used machine learning to bypass the verification code of the E-ZPass New York website:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Adrian does not have access to the source code of the app that generated the captcha image. In order to crack the system, he had to download hundreds of sample images and manually answer them to train his deep learning system. But what if we want to break an open source verification code system? I went to the wordpress.org plugin registry to search for "verification code". The top result is a plugin called "Real Simple Verification Code" with over 1 million active installations:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

And the best part is that it is open source! Since we have the source code that generates the captcha, this should be easy to crack. To make things more challenging, let us give ourselves a time limit. Can we crack this verification code system in 15 minutes? Let us give it a try! IMPORTANT: This is by no means a criticism of the "true simple verification code" plugin or its author. The plugin author himself also said that this plugin is no longer safe and I suggest you use something else. This is just a quick and interesting technical challenge. But if you are one of the remaining 1 million users, maybe you should switch to another plugin :)

The challenge begins

To create an offensive plan, let's first take a look at what type of image this plugin will generate. On the demo site, we see this:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Ok, so the captcha image seems to be four letters. Let's verify this in the PHP source code:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Yes, it produces a four-letter verification code and uses four different fonts that are randomly combined. We can see that it never uses "O" or "I" in the code to avoid user confusion. This gives us a total of 32 letters and numbers that may need to be identified. no problem! The time has passed so far: 2 minutes.

Our toolset

Before we go any further, let's talk about the tools we'll use to solve this problem: Python 3Python is a very interesting programming language with good machine learning and computer vision libraries. OpenCVOpenCV is a popular computer vision and image processing framework. We will use OpenCV to process the captcha image. It has a Python application interface, so we can use it directly from Python. KerasKeras is a deep learning framework written in Python. It allows us to easily define, train, and use deep neural networks with minimal code. TensorFlowTensorFlow is Google's machine learning library. We will write code in Keras, but Keras does not really implement the logic of the neural network itself. It actually calls Google's TensorFlow in the background for calculation. Ok, let's go back to the challenge now!

Create our data set

To train any machine learning system, we all need to train the data set. To crack a captcha system, we need the training data to look like this:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

This is the only part that I won't give you sample code. We do this for education, I don't want you to really go to the Black WordPress site. However, I will give you the 10,000 images I generated last so that you can repeat my results. The time has passed so far: 5 minutes.

Simplify the problem

Now that we have the training data, we can use it directly to train the neural network:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

With enough training data, this rude method works even well - but we can make the problem easier to solve. The simpler the problem, the less training data and the less computational resource consumption. After all, we only have 15 minutes! Fortunately, the captcha image is always composed of four letters. If we can segment the image in some way so that each letter is a separate image, then we only need to train the neural network to recognize one letter at a time:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

I don't have time to browse through 10,000 training images and manually split them into separate images in Photoshop. It will take a few days, and I only have 10 minutes left. And we can't divide the image into four blocks of the same size, because the captcha will randomly place the letters in different horizontal positions:

The letters in each image are randomly placed, making it more difficult to segment the image.

Fortunately, we can still do this automatically. In image processing, we often need to detect groups of pixels with the same color. The boundaries around these successive groups of pixels are called contours. OpenCV has a built-in findContours() function that can be used to detect these contiguous regions. Then we will start with an original captcha image:

Then we convert the image to pure black and white (this is called threshold setting), which makes it easy to find continuous areas:

Next, we'll use OpenCV's findContours() function to detect successive groups of pixels in the image that contain the same color:

Then just save each area as a separate image file. And since we know that each image should contain four letters from left to right, we can use this knowledge to mark the letters. As long as we save them in order, we can save each letter image with the appropriate letter name. But wait - I see a problem! Sometimes the verification code has such overlapping letters:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

This means that we will eventually extract the area where the two letters are pieced together:

If we don't deal with this problem, we will end up creating bad training data. We need to solve this problem so that we don't accidentally let the machine recognize the two connected letters as a letter.

We will split any area that is longer than the height in half and treat it as two letters. This is very rude, but doing so will still work to identify these verification codes.

Now that we have a way to extract a single letter, let's run it on all CAPTCHA images. The goal is to collect different variations of each letter. We can save each letter in its own folder. Here's what my "W" folder looks like after I extract all the letters:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Some "W" letters extracted from our 10,000 captcha images. I got a total of 1147 different "W" images. The time has passed so far: 10 minutes.

Create and train neural networks

Since we only need to identify images of individual letters and numbers, we don't need a very complex neural network architecture. Identifying letters is much easier than identifying complex images such as pictures of cats and dogs. We will use a simple convolutional neural network structure with two convolutional layers and two fully connected layers:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

If you want to know more about how convolutional neural networks work, why they are ideal for image recognition, check out Adrian's book or my previous article. Defining this neural network architecture with Keras requires only a few lines of code:

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Now we can start training it!

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

After training 10 times with the training data set, we achieved nearly 100% accuracy. Now, as long as we think, we should be able to bypass this verification code automatically! We did it! The time has passed so far: 15 minutes. (~!)

Use the trained model to crack the verification code

Now, we have a well-trained neural network, and it's very simple to use it to crack the real verification code: 1. Grab the real captcha image from the website using the WordPress plugin. 2. Decompose the captcha image into four separate letter images using the same method we used to create the training data set. 3. Ask our neural network to make a separate prediction for each letter image. 4. Use the four predicted letters as the answer to the verification code. 5. Have fun playing the following is how our model decodes the real verification code.

Or from the command line

Briefly describes how to use machine learning to bypass the verification code of the E-ZPass New York website.

Incremental Encoder

Incremental encoders provide speed, direction and relative position feedback by generating a stream of binary pulses proportional to the rotation of a motor or driven shaft. Lander offers both optical and magnetic incremental encoders in 4 mounting options: shafted with coupling, hollow-shaft, hub-shaft or bearingless. Single channel incremental encoders can measure speed which dual channel or quadrature encoders (AB) can interpret direction based on the phase relationship between the 2 channels. Indexed quadrature encoders (ABZ) are also available for homing location are startup.

Incremental Encoder,6Mm Solid Shaft Encoder,Hollow Rotary Encoder,Elevator Door Encoder

Jilin Lander Intelligent Technology Co., Ltd , https://www.jilinlandermotor.com